#include <cstdio>

#include "consts.h"
#include "io.h"

void get_board(char chess[][4])
{
	for (int i = 0; i < 4; i++)
	{
		for (int j = 0; j < 4; j++)
		{
			chess[i][j] = getchar();
		}
		getchar();
	}
}

void convertArrayToInt(char chess[][4], int & chess_x, int & chess_o)
{
	chess_x = 0;
	chess_o = 0;

	for (int i = 0; i < 4; i++)
	{
		for (int j = 0; j < 4; j++)
		{
			if (chess[i][j] == XPAWN)
			{
				chess_x |= (1 << (i * 4 + j));
			}
			else if (chess[i][j] == OPAWN)
			{
				chess_o |= (1 << (i * 4 + j));
			}
		}
	}
}

void print_board(int chess_x, int chess_o)
{
	for (int i = 0; i < 4; i++)
	{
		for (int j = 0; j < 4; j++)
		{
			if (chess_x & (1 << (i * 4 + j)))
				putchar(XPAWN);
			else if (chess_o & (1 << (i * 4 + j)))
				putchar(OPAWN);
			else
				putchar(EMPTYCELL);
		}
		putchar('\n');
	}
}